<?php /*a:2:{s:65:"D:\laragon\www\jiaqueshop\application\manage\view\coupon_add.html";i:1585357362;s:59:"D:\laragon\www\jiaqueshop\application\manage\view\base.html";i:1596192950;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
	<meta name="renderer" content="webkit">
<title>后台管理系统</title>
<link rel="stylesheet" href="/static/public/awesome/css/font-awesome.min.css" />

<link rel="stylesheet" href="/static/public/layui/css/layui.css" />

<link rel="stylesheet" href="/static/public/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="/static/manage/css/style.css" />

	<link rel="stylesheet" href="/static/public/dist/zoomify.min.css">
	
<script src="/static/public/kindeditor/kindeditor-all.js"></script>
<script src="/static/public/kindeditor/lang/zh_CN.js"></script>
<script src="/static/public/ueditor/ueditor.config.js?t=<?php echo time();?>"></script>
<script src="/static/public/ueditor/ueditor.all.min.js"></script>
<script src="/static/public/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
<?php if($is_auth): ?>

<script language="javascript" type="text/javascript" src="/static/public/My97DatePicker/WdatePicker.js"></script>
<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="<?php echo url('index/welcome'); ?>"><i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>商城</span>
            <span class="icon-angle-right"></span>
            <span>优惠券管理</span>
            <span class="icon-angle-right"></span>
            <span>优惠券管理</span>
            <span class="icon-angle-right"></span>
            <span><?php echo !empty($info) ? '编辑'  :  '添加'; ?>优惠券</span>
            <a class="u-flush"><i class="icon-repeat"></i></a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">
            <div class="m-form">
                <form class="layui-form" id="j_form">
                    <table class="m-table">
                        <tbody>
                            <tr>
                                <th colspan="2">优惠券信息</th>
                            </tr>
                            <tr>
                                <td width="15%"><label for="coupon_name">优惠券名称<em>*</em></label></td>
                                <td><input type="text" class="u-ipt u-ipt-longer" name="coupon_name" id="coupon_name" placeholder="请输入优惠券名称" value="<?php echo htmlentities($info['coupon_name']); ?>" /></td>
                            </tr>
                            <tr>
                                <td width="15%"><label for="description">优惠券描述</label></td>
                                <td><textarea name="description" id="description" style="width:100%;"><?php echo htmlentities($info['description']); ?></textarea></td>
                            </tr>
                            <tr>
                                <td width="15%"><label for="offset_price">冲抵金额</label></td>
                                <td><input type="text" class="u-ipt u-ipt-small" name="offset_price" id="offset_price" placeholder="请输入冲抵金额" value="<?php echo htmlentities($info['offset_price']); ?>" /></td>
                            </tr>
                            <tr>
                                <td width="15%"><label for="limit_price">限制使用金额</label></td>
                                <td><input type="text" class="u-ipt u-ipt-small" name="limit_price" id="limit_price" placeholder="请输入限制使用金额" value="<?php echo htmlentities($info['limit_price']); ?>" /><span>元</span></td>
                            </tr>
							<tr>
								<td width="15%"><label>优惠券类型类型</label></td>
								<td>
									<input type="radio" lay-filter="coupon_type" name="coupon_type" value="0" title="通用" <?php if(isset($info['coupon_type']) && ($info['coupon_type'] == 0)): ?> checked<?php endif; ?> />
									<input type="radio" lay-filter="coupon_type" name="coupon_type" value="1" title="指定分类" <?php if(isset($info['coupon_type']) && ($info['coupon_type'] == 1)): ?> checked<?php endif; ?> />
									<input type="radio" lay-filter="coupon_type"  name="coupon_type" value="2" title="指定商品" <?php if(isset($info['coupon_type']) && ($info['coupon_type'] == 2)): ?> checked<?php endif; ?> />
								</td>
							</tr>

                            <tr id="fl">
                                <td><label for="">使用范围<em>*</em></label></td>
                                <td>

									<?php if(is_array($menus) || $menus instanceof \think\Collection || $menus instanceof \think\Paginator): if( count($menus)==0 ) : echo "" ;else: foreach($menus as $key1=>$nav): ?>
									<div class="privilege-item lay-checked clearfix">
										<dl class="clearfix" style="border-bottom:none" >
											<dt><h3 class="lay-checkbox"><input type="checkbox" class="select_item_all" lay-skin="primary" title="<?php echo htmlentities($nav['name']); ?>" lay-filter="h3_privilege" /></h3></dt>
										<?php if(is_array($nav['child']) || $nav['child'] instanceof \think\Collection || $nav['child'] instanceof \think\Paginator): if( count($nav['child'])==0 ) : echo "" ;else: foreach($nav['child'] as $key2=>$first): ?>
										<dd><h3 class="lay-checkbox"><input type="checkbox" name="scope[]" value="<?php echo htmlentities($first['id']); ?>" lay-skin="primary" title="<?php echo htmlentities($first['name']); ?>" <?php if($info && in_array($first['id'], explode(',',$info['scope']))): ?> checked<?php endif; ?>/></h3></dd>

										<?php endforeach; endif; else: echo "" ;endif; ?>
										</dl>
									</div>
									<?php endforeach; endif; else: echo "" ;endif; ?>
                                </td>
                            </tr>
							<tr id="sp">
								<td><label for="">使用范围<em>*</em></label></td>
								<td>
									<div class="privilege-item lay-checked clearfix" style="margin-bottom: 0px;padding:0;border-bottom:none">
										<dl class="clearfix" style="border-bottom:none" id="xuanzhongs">
											<dt><h3 class="lay-checkbox"><input type="checkbox" class="select_item_all" lay-skin="primary" title="全选" lay-filter="h3_privilege" /></h3></dt>
											<?php if(is_array($goods) || $goods instanceof \think\Collection || $goods instanceof \think\Paginator): if( count($goods)==0 ) : echo "" ;else: foreach($goods as $key=>$good): ?>
											<dd class="lay-checkbox"><input type="checkbox" name="goods[]" id="goods" lay-skin="primary" title="<?php echo htmlentities($good['goods_name']); ?>" value="<?php echo htmlentities($good['id']); ?>" <?php if($info && in_array($good['id'], explode(',',$info['goods']))): ?> checked<?php endif; ?>/></dd>
											<?php endforeach; endif; else: echo "" ;endif; ?>
										</dl>
									</div>
								</td>
							</tr>

                            <tr>
                                <td width="15%"><label for="limit_price">可领取开始时间</label></td>
                                <td><input type="text" name="pbegin" class="u-ipt u-ipt-long" id="pbegin" placeholder="开始时间" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="<?php echo !empty($info['pbegin']) ? date('Y-m-d',$info['pbegin'])  :  date('Y-m-d', time()); ?>" readonly=""></td>
                            </tr>
                            <tr>
                                <td width="15%"><label for="limit_price">可领取结束时间</label></td>
                                <td><input type="text" name="pend" class="u-ipt u-ipt-long" id="pend" placeholder="结束时间" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="<?php echo !empty($info['pend']) ? date('Y-m-d',$info['pend'])  :  date('Y-m-d', time()); ?>" readonly=""><span>默认到所选日期的23:59:59</span></td>
                            </tr>
                            <tr>
                                <td><label for="">有效时间</label></td>
                                <td><input type="text" class="u-ipt u-ipt-small" name="valid_time" id="valid_time" placeholder="请输入有效时间" value="<?php echo htmlentities($info['valid_time']); ?>" /><span>天</span></td>
                            </tr>
                            <input type="hidden" value="<?php echo !empty($info['register_time']) ? htmlentities($info['register_time']) :  time(); ?>" name="register_time" id="register_time"/>
                        </tbody>
                    </table>
                    <div class="m-form-btn">
                        <input type="hidden" name="id" id="id" value="<?php echo htmlentities($info['id']); ?>">
                        <button id="j_btn" type="button" class="u-btn">确定提交</button></div>
                </form>
            </div>
        </div>
    </div>
</div>

<?php endif; ?>
<input type="hidden" name="action_uri" value="<?php echo url('action'); ?>" />

<input type="hidden" name="redirect_uri" value="<?php echo url('index'); ?>" />

<input type="hidden" name="region_uri" value="/manage/regions/regions" />
<script src="/static/public/js/jquery-1.10.2.js"></script>
<script src="/static/public/js/maniac.ui.js"></script>
<script src="/static/public/layui/layui.js" charset="utf-8"></script>
<script src="/static/public/js/aes.js"></script>
<script src="/static/public/js/mode-ecb-min.js"></script>
<script src="/static/public/js/utils.js"></script>
<script src="/static/public/js/dialog.js"></script>
<script src="/static/manage/js/form.js"></script>
<script src="/static/manage/js/js.js"></script>
<script src="/static/public/js/app.js"></script>
<script src="/static/public/js/encrypt.js"></script>
<script src="/static/public/dist/zoomify.min.js"></script>
<script type="text/javascript">
    $('.fdzoom').zoomify();
</script>

<script>
var aesKey = '<?php echo htmlentities($encrypt_key); ?>';
    $(function(){
        layui.use('layer', function(){
            var user_exists = parseInt('<?php echo !empty($user_exists) ? 1  :  0; ?>');
            var user_forbidden = parseInt('<?php echo !empty($user_forbidden) ? 1  :  0; ?>');
            var quit_force = parseInt('<?php echo !empty($quit_force) ? 1  :  0; ?>');
            var is_auth    = parseInt('<?php echo !empty($is_auth) ? 1  :  0; ?>');
            
            if (user_exists) {
                dialog.error('您所登录的用户已被删除', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (user_forbidden) {
                dialog.error('您的账户已被禁用', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }

            if (quit_force) {
                dialog.error('同一账户同一时间只能一人在线', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (!is_auth) {
                dialog.error('您没有权限执行此操作', function(){
                    window.location.href = history.go(-1);
                    return false;
                });
            }
        });
    })
</script>

<script src="/static/public/js/jquery-ui.min.js"></script>
<script>
    $(function () {
        var keyValue;
        keyValue = $("input[name='coupon_type']:checked").val();

        if (keyValue == 0) {
            $("#fl").hide();
            $("#sp").hide();
        }
        if (keyValue == 1) {
            $("#fl").show();
            $("#sp").hide();
        }
        if (keyValue == 2) {
            $("#fl").hide();
            $("#sp").show();
        }
    })
    layui.use('form', function () {
        var form = layui.form;
        form.on('radio(coupon_type)', function (data) {
            if (data.value == 0) {
                $("#fl").hide();
                $("#sp").hide();
            }
            if (data.value  == 1) {
                $("#fl").show();
                $("#sp").hide();
            }
            if (data.value  == 2) {
                $("#fl").hide();
                $("#sp").show();
            }
            form.render();
        });
        form.on('radio(commission_charge_type)', function (data) {
            if (data.value == 0) {
                $('.commission_charge_first').attr("disabled",true);
                $('.commission_charge_second').attr("disabled",true);
            }
            if (data.value  == 1) {
                $('.commission_charge_first').attr("disabled",false);
                $('.commission_charge_second').attr("disabled",false);
            }
            if (data.value  == 2) {
                $('.commission_charge_first').attr("disabled",false);
                $('.commission_charge_second').attr("disabled",false);
            }
            form.render();
        });
    });
</script>

</body>
</html>